#include "session_manager.h"
#include "nlohmann/json.hpp"
#include "../common/common.h"

namespace ArrowWebCodeView
{

CSessionManager::CSessionManager()
{
}

CSessionManager::~CSessionManager()
{
    Deini();
}

void CSessionManager::Init(asio::io_context& ioContext)
{
}

void CSessionManager::Run()
{
    return;
}

void CSessionManager::Deini()
{
}

void CSessionManager::AddSession(SharedPtrISession pSession)
{
    if(m_setSessions.find(pSession) != m_setSessions.end())
        return;

    m_setSessions.insert(pSession);
}

void CSessionManager::RemoveSession(SharedPtrISession pSession)
{
    m_setSessions.erase(pSession);
    if(m_setSessions.size() == 0)
    {
        m_setMsgSrcInfo.clear();
    }
}

int32_t CSessionManager::Count()
{
    return m_setSessions.size();
}

} // namespace ArrowWebSocket
